/*
** 3086.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Wed Oct  1 22:07:06 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "3086.h" */
/*
 * EXPERIENCE: HUGE NUMBER TRAP, exceeds the bound of int!!!!!
 */
#include <stdio.h>

int main()
{
     int instance, i, src, product;

     scanf("%d", &instance);
     for(i = 1; i <= instance; i++){
	  scanf("%d", &src);
	  if (src % 2 == 0)
	       if (src % 4 == 0)
		    product = (src/4)*(src+1)*((src+2)/2)*(src+3);
	       else product = (src/2)*(src+1)*((src+2)/4)*(src+3);
	  else
	       if ((src + 1) % 4 == 0)
		    product = src*((src+1)/4)*(src+2)*((src+3)/2);
	       else product = src*((src+1)/2)*(src+2)*((src+3)/4);
	  printf("%d %d %d\n", i, src, product);
     }
     return 0;
}

